/*
 * p2187.cpp
 *
 *  Created on: 2013-3-17
 *      Author: zy
 */

/*
 * ConvexHull.cpp
 *
 *  Created on: 2013-3-16
 *      Author: zy
 */
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int sig(double d) {
	return fabs(d) < 1E-6 ? 0 : d < 0 ? -1 : 1;
}
struct Point{
	double x, y;
	double k;
	Point(){}
	Point(double x, double y): x(x), y(y) {}
	void set(double x, double y) {
		this->x = x;
		this->y = y;
	}
	double mod(){//模
		return sqrt(x*x+y*y);
	}
	double mod_pow(){//模的平方
		return x*x + y*y;
	}
	void output() {
		printf("x = %f, y = %f\n", x, y);
	}
	bool operator < (const Point &p) const {
		return sig(x-p.x) != 0 ? x < p.x : sig(y-p.y) < 0;
	}
};

double cross(Point o, Point a, Point b) {
	return (a.x - o.x)*(b.y - o.y)-(b.x - o.x)*(a.y - o.y);
}
double dot(Point &o, Point &a, Point &b) {
	return (a.x-o.x)*(b.x-o.x) + (a.y-o.y)*(b.y-o.y);
}
int btw(Point &x, Point &a, Point &b) {
	return sig(dot(x, a, b));
}
int g_cmp(const void *a, const void *b) {
	int d = sig(((Point*)a)->y-((Point*)b)->y);
	return d ? d : sig(((Point*)a)->x-((Point*)b)->x);
}

/**
	凸包: jarvis步进法
	------------------
	p: 原始的点
	n: 点的个数
	ch:存储凸包的点（回路，首位相接）

	与graham不同，不会改变p的位置
*/
int jarvis(Point *p, int n, int *ch)
{
	static int d, i, o, s, l, t;
	for(d = i = 0; i < n; i ++)
		if(p[i] < p[d])
			d = i;
	l = s = *ch = d;
	d =1;
	do {
		o = l;
		for(i = 0; i < n; i ++)
			if((t=sig(cross(p[o], p[l], p[i])))>0
|| (t==0 && btw(p[l], p[o], p[i])<=0))
				l = i;
		ch[d ++] = l;
	} while(l != s);
	return d-1;
}
/*
 * 多边形有向面积，逆时针输入为正！
 */
double area(Point * p, int n) {
	double res = 0;
	p[n] = p[0];
	for(int i = 0; i < n; i ++) {
		res += p[i].x*p[i+1].y - p[i+1].x*p[i].y;
	}
	return res / 2;
}
double dis(Point a, Point b) {
	return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
/**
 * 求凸多边形直径！注意传入凸多边形！
 */
double diam(Point *p, int n) {
	if(area(p, n)<0)	reverse(p, p+n);
	p[n] = p[0];
	double res = 0;
	for(int i = 0, j = 1; i < n; i ++) {
		while(sig(cross(p[i], p[i+1], p[j])-cross(p[i], p[i+1], p[(j+1)%n])) < 0)
			j = (j+1)%n;
		res = max(res, dis(p[i], p[j]));
		res = max(res, dis(p[i+1], p[j]));
	}
	return res;
}

int main()
{
	Point p[50010],q[50010];
	int c[50010];
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%lf%lf",&p[i].x,&p[i].y);
	n=jarvis(p,n,c);
	for(int i=0;i<n;i++)
		q[i]=p[c[i]];
	printf("%d\n",(int)diam(q,n));
	return 0;
}

